<?php
class DBTable
{
	private $tableStructure = array();
	private $primaryKey;
	private $name;

	public function __Construct($db,$table)
	{
		$sql = "DESCRIBE ".$table;
		$db->ExecuteSQL($sql);
		while($row = $db->getRow())
		{
			if($row['Key']=="PRI")
				$this->primaryKey = $row['Field'];
			$this->tableStructure[$row['Field']] = $row['Type'];
		}
		$this->name = $table;
	}

	public function getTableStructure()
	{
		return $this->tableStructure;
	}

	public function getType($field)
	{
		return $this->tableStructure[$field];
	}
	public function getPrimaryKey()
	{
		return $this->primaryKey;
	}

}
?>